<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>会员列表</title>
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/font-awesome.min93e3.css?v=4.4.0"/>
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.16/css/jquery.dataTables.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/plugins/datapicker/datepicker3.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/plugins/chosen/chosen.css"/>
    <link href="<%=path%>/hplus/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="<%=path%>/hplus/js/plugins/sweetalert/sweetalert2.min.css" rel="stylesheet">
    <link href="<%=path%>/hplus/css/plugins/zTree/zTreeStyle/metro.css" rel="stylesheet">

   <%--  <link href="<%=path %>/hplus/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet"> --%>
    <link href="<%=path %>/hplus/css/plugins/iCheck/custom.css" rel="stylesheet">
	<%-- <link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/style.min.css"/> --%>
    <style type="text/css">
		.ztree li a.curSelectedNode{
		background-color:#BEEBFF;
		}
		.radio-primary input[type="radio"] + label::after {background-color: #1ab394;}
		.radio-primary input[type="radio"]:checked + label::after {background-color: #1ab394;}
		.radio-primary input[type="radio"]:checked + label::before {border-color: #1ab394;}
		.rdo{
		    width: 20px;
		    height: 0px;
		    background-color: #000;
		    margin-right: 30px;
		    border-radius: 50%;
		    position: relative;
		}
		.ztree li span.button.noline_close{background-position: -126px -84px;}
	    .ztree li span.button.noline_open{background-position: -105px -84px;}
	    .caoZuo{font-size: 15px;margin: 0 4px;color:#676a6c; width:120px;}

		.checkbox_select input[type="checkbox"] + label::before{
		  content:"\00a0";//Unicode字符集，生成“空格”
		  display:inline-block;
		  width:12px;
		  height:12px;
		  line-height:12px;
		  border-radius:3px;
		  margin:3px;
		  background-color:yellowgreen;
}
		input[type=radio] {
			margin-top: 0 !important;
		}
		.checkbox label, .radio label {
			cursor: default;
		}
	</style>
</head>
<body class="gray-bg">


<div class="wrapper wrapper-content">

	<%-- <!--  导航按钮-->
	<div class="couton"style="padding: 10px,0,10px,0">
		<shiro:hasPermission name="scrm_sms_validate_employee">
		<button type="button" name="aint" class="btn btn-default btn-lg" style="background-color: white;color: black;border:none;" onclick="messagestaff('1')">短信验证员工</button>
		 </shiro:hasPermission>
		<shiro:hasPermission name="scrm_already_delete_employee">
		<button type="button" name="deleteint"class="btn btn-info btn-lg" style="background-color: #F5F5F5;color: black;border:none;" onclick="messagestaff('2')">已删除员工</button>
	 	</shiro:hasPermission>
	</div> --%>
	<!-- 条件查询 -->
    <div class="row searchCondition" style="background-color: white;padding: 10px;">
        <div class="row">
       			<!-- <div class="col-sm-12" style="height:20px;margin:10px">
					<span id="liename" style="font-weight:bold;font-size:16px">员工列表</span></label></label>
				</div> -->
        	<div class="col-sm-12">
            <div class="col-sm-2" style="width:210px">
				姓名
                <input id="name" placeholder="请输入姓名" class="form-control chosen-select" maxlength="10" style="width: 150px;display: inline-block;" autocomplete="off">
            </div>

            <div class="col-sm-2" style="width:210px">
              	手机
              	<input id="phone" type="text" class="form-control" maxlength="11" placeholder="请输入手机号" onkeyup="value=value.replace(/[^\d]/g,'')" style="width: 150px;display: inline-block;">
            </div>

            <!-- <div class="col-sm-3 jfoucs" style="width: 440px;">
	           	 积分：<a class="cfoucs" point="0"  style=" margin-right: 12px;"><input type="radio" class="aa">不限</a><a class="cfoucs" point=""><input type="radio" class="aa">自定义</a>
	         	<span id="custPoint" style="display: none;">
	            <input id="point1" type="number" class="form-control" style="width: 60px;display: inline-block;">
	            	至
	            <input id="point2" type="number" class="form-control" style="width: 60px;display: inline-block;">
	            </span>
	        </div> -->
	      <!--  <div class="col-sm-6  jfoucs" style="max-width:300px;">
		           		<label class="col-sm-2" style="margin-top:10px; min-width:100px;">累计积分</label>
		           		<a class="cfoucs" point="0"><div class="radio radio-primary col-sm-2" style="min-width:80px;">
					                <input id="no_limit" type="radio" checked="checked" name="limit_activity" >
					                <label for="no_limit" style="min-width:60px;">不限</label>
			           	</div></a>
			           	<a  class="cfoucs" point="">
	           				<div class="radio radio-primary col-sm-2" style="margin-top:10px;min-width:60px;">
				                <input id="limit" type="radio"  name="limit_activity" >
				                <label for="limit" style="min-width:100px;">自定义</label>
	           				</div>
			           	</a>
		   </div> -->
		    <div class="col-sm-3">
           		<span id="custPoint" style="display: none;">
			            <input id="point1" type="text" value="" onkeyup='this.value=this.value.replace(/[^0-9]*$/,"")' onblur='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' class="form-control" maxlength="10" style="width: 60px;display: inline-block;">
			            	至
			            <input id="point2" type="text" value="" onkeyup='this.value=this.value.replace(/[^0-9]*$/,"")' onblur='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' class="form-control" maxlength="10" style="width: 60px;display: inline-block;">
          					</span>
			  </div>
            <div class="col-sm-1" style="float:right" >
            	<button onclick="func_dataTableReload()" class="btn btn-primary" type="button">查询</button>
            </div>
            </div>
        </div>

        <div class="row" style="line-height: 40px;padding: 10px;">
            <div class="col-sm-2 jfoucs" style="width: 90px;height: 30px;line-height: 30px;">
                                注册时间
            </div>
            <div class="col-sm-3" style="padding: 0;height: 40px;" id="data_5" style="width:240px;">
                <div class="input-daterange input-group" id="datepicker">
                    <input type="text" class="input-sm form-control" name="start" value="2018-01-01" id="starttime" style="height:35px;width:100px">
                    <span class="input-group-addon" style="height: 24px;">到</span>
                    <input type="text" class="input-sm form-control" name="end" value="2018-12-31" id="endtime" style="height:35px;width:100px">
                </div>
            </div>
            <div class="col-sm-3">
              	员工状态
              	<select id="is_freeze" class="form-control" style="width: 100px;display: inline-block;">
              		<option value="">不限</option>
              		<option value="0">正常</option>
              		<option value="1">冻结</option>
              		<option value="2">删除</option>
              	</select>
            </div>
	        <div class="form-group">
                    <label class="col-sm-2 control-label" style="width:100px"><span class="red" style="margin-right:2px">*</span>所属部门</label>
                    <div class="col-sm-3">
                        <button class="btn btn-primary btn-outline" type="button" data-toggle="modal" href="#" data-target="#myModa4like" >选择部门</button>
                    </div>
             </div>
    	</div>
	</div>
	<!--操作按钮  -->
    <div class="row" style="background-color: white;padding: 10px 0;">
    	<div class="col-sm-4">
        </div>
        <div class="col-sm-8 text-right">
        		<shiro:hasPermission name="employee:batch_freeze">
        		<button class="btn btn-primary" data-toggle="modal" data-target="#Thaw">批量冻结</button>
        		 </shiro:hasPermission>
        		 <shiro:hasPermission name="employee:batch_thaw">
        		<button class="btn btn-primary" data-toggle="modal" data-target="#ThawJ">批量解冻</button>
        		</shiro:hasPermission>
        		 <%-- <shiro:hasPermission name="employee:batch_change_integral">
            	<button class="btn btn-primary" data-toggle="modal" data-target="#Thawjfbg">批量积分变更</button>
            	</shiro:hasPermission> --%>
        		 <shiro:hasPermission name="employee:batch_delete">
            	<button class="btn btn-primary" data-toggle="modal" data-target="#Thawdelete">批量删除</button>
            	</shiro:hasPermission>
        		<%--  <shiro:hasPermission name="employee:batch_create">
            	<button class="btn btn-primary" data-toggle="modal" data-target="#myModal">新增员工</button>
            	</shiro:hasPermission> --%>
        		 <shiro:hasPermission name="employee:export_csv">
            	<a id="export" href="javascript:void(0)">
            	<button class="btn btn-primary" type="button">导出CSV</button>
            	</a>
            	</shiro:hasPermission>
        </div>
    </div>
    <!--列表头  -->
    <div>
	            <table class="table table-bordered" role="grid" id="myTable">
					<thead>
			            <tr style="background-color: white;">
			            	<th style="width:40px; padding:10px 0 10px 10px">
		                	<input type="checkbox" id="checkall"></th>
		                	<th>序号</th>
			                <th>基本资料</th>
			                <th>部门</th>
			               	<th>姓名</th>
			               	<th>手机号</th>
			                <th>注册时间</th>
			                <th>状态</th>
			                <th style="width:200px;">操作</th>
			            </tr>
			            </thead>
			            <tbody>
				</table>
	        </table>
    </div>
</div>
<!--部门树  -->
 <div hidden="" class="modal inmodal fade" id="myModa4" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-sm" style="z-index: 1040;" >
            <div class="modal-content"  style="width:400px;">
                <div class="modal-header" style="padding: 15px 15px 10px;">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="text-left">用户部门配置</h4>
                </div>
                <div class="text-center" style="width:100%;height:60px;">
                <!-- CRM角色 -->
                <div class="form-group">
                    <label class="col-sm-3 control-label">请选择部门</label>
                    <div style="overflow-x:auto;height:250px;" class="col-sm-9">
                      <!-- 引入zTree -->
                      <ul id="tree" class="ztree" ></ul>
                      <input id="belognDepartmentId" style="display:none;"></input>
                    </div>
                </div>

                </div>
                 <div class="modal-footer" style="text-align:center;border-top:none;">
                     <button type="button" class="btn btn-outline btn-primary" onclick="cancel();" style="margin-right:40px;">取消</button>
                     <button type="button" class="btn btn-primary k_verify" onclick="addDempent()">确定</button>
                 </div>
             </div>
        </div>
    </div>
    <!--搜索部门树  -->
 <div hidden="" class="modal inmodal fade" id="myModa4like" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-sm" style="z-index: 1040;" >
            <div class="modal-content"  style="width:400px;">
                <div class="modal-header" style="padding: 15px 15px 10px;">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="text-left">用户部门配置</h4>
                </div>
                <div class="text-center" style="width:100%;height:60px;">
                <!-- CRM角色 -->
                <div class="form-group">
                    <label class="col-sm-3 control-label">请选择部门</label>
                    <div style="overflow-x:auto;height:250px;" class="col-sm-9">
                      <!-- 引入zTree -->
                      <ul id="treelike" class="ztree" ></ul>
                      <input id="belognDepartmentId" style="display:none;"></input>
                      <input id="belognDepartmentName" style="display:none;"></input>
                    </div>
                </div>

                </div>
                 <div class="modal-footer" style="text-align:center;border-top:none;">
                     <button type="button" class="btn btn-outline btn-primary" onclick="cancelLike();" style="margin-right:40px;">取消</button>
                     <button type="button" class="btn btn-primary k_verify" onclick="addDempentlike()">确定</button>
                 </div>
             </div>
        </div>
    </div>
<!--新增员工  -->
<form id="MarketingSave" method="post" class="form-horizontal">
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style=" z-index: 1050; ">
		<div class="modal-content" style="width:500px;height:350px;">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h2 class="modal-title" id="myModalLabel" >
					<span style="font-weight:bold" id="totalname">添加员工</span>
					<input id="insertstaff" value="1"  type="hidden">
				</h2>
			</div>
			<div class="modal-body">
				<form method="get" class="form-horizontal">
	            <div class="row">
	                <div class="form-group" style="margin-bottom:10px;">
	                    <label class="col-sm-3 control-label">员工手机：</label>
	                    <div class="col-sm-5" style="margin-bottom:10px;">
	                    	<input id="staId" type="hidden" value="">
	                        <input id="phone" type="text" class="form-control phone" maxlength="11" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
	                    </div>
	                </div>
	            </div>

	            <div class="row">
	                <div class="form-group" style="margin-bottom:10px;">
	                    <label class="col-sm-3 control-label">员工姓名：</label>
	                    <div class="col-sm-5" style="margin-bottom:10px;">
	                        <input id="name" type="text" class="form-control name" maxlength="10">
	                    </div>
	                </div>
	            </div>

	            <div class="row">
	                <div class="form-group" style="margin-bottom:10px;">
	                    <label class="col-sm-3 control-label">OpenId：</label>
	                    <div class="col-sm-5" style="margin-bottom:10px;">
	                        <input id="openId" type="text" class="form-control openId" maxlength="30" >
	                    </div>
	                </div>
	            </div>

	            <div class="row">
	                    <div class="form-group" style="margin-bottom:10px;">
	                    <label class="col-sm-3 control-label">所属部门</label>
		                    <div class="col-sm-5">
		                        <button onclick="hidein()" class="btn btn-primary btn-outline" id="add" type="button" data-toggle="modal" href="#" data-target="#myModa4" >选择部门</button>
		                    </div>
	                    </div>
	            </div>

				<div class="modal-footer" style="text-align:center;border-top:none;">
					<button type="button" class="btn btn-default" data-dismiss="modal" onclick="staffSaveDel()" style="margin-right:40px;">取消</button>
					<button type="button" class="btn btn-primary" onclick="func_saveStaff()">确定</button>
				</div>
	        </form>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
</form>
<!--批量冻结  -->
<div class="modal fade" id="Thaw" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content" style="width:400px;height:250px;">
			<div class="modal-header">
				<h2 class="modal-title" id="myModalLabel" >
					<span style="font-weight:bold">冻结确认</span>
				</h2>
			</div>
			<div class="modal-body">
				<form method="get" class="form-horizontal">
	            <div class="row" style="height:100px;text-align:center;padding-top:45px">
	               		<input type="hidden" id="jie"  value="">
	                      <span style="text-align:center;">您确定要冻结此员工吗?</span>
	            </div>
				<div class="modal-footer" style="text-align:center;border-top:none;">
					<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right:40px;">取消</button>
					<button type="button" class="btn btn-primary" onclick="Batch_operation('1','1')">确定</button>
				</div>
	        </form>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
<!-- 批量解冻 -->
<div class="modal fade" id="ThawJ" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content" style="width:400px;height:250px;">
			<div class="modal-header" >
				<h2 class="modal-title" id="myModalLabel" >
					<span style="font-weight:bold">解冻确认</span>
				</h2>
			</div>
			<div class="modal-body">
				<form method="get" class="form-horizontal">
	            <div class="row" style="height:100px;text-align:center;padding-top:45px">
	            		<input type="hidden" id="que"  value="">
	                  <span>您确定要解冻此员工吗?</span>
	            </div>
				<div class="modal-footer" style="text-align:center;border-top:none;">
					<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					<button type="button" class="btn btn-primary" onclick="Batch_operation('2','3')">确定</button>
				</div>
	        </form>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
<!--批量删除  -->
<div class="modal fade" id="Thawdelete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content" style="width:400px;height:250px;">
			<div class="modal-header" >
				<h2 class="modal-title" id="myModalLabel" >
					<span style="font-weight:bold">删除确认</span>
				</h2>
			</div>
			<div class="modal-body">
				<form method="get" class="form-horizontal">
	            <div class="row" style="height:100px;text-align:center;padding-top:45px">
                       	<input type="hidden" id="del"  value="">
                       	<input type="hidden" id="phon"  value="">
                       	<span>您确定要删除此员工吗?<br></span>
						<span>删除动作不可恢复，请谨慎操作</span>
	            </div>
				<div class="modal-footer" style="text-align:center;border-top:none;">
					<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right:40px;">取消</button>
					<button type="button" class="btn btn-primary" onclick="Batch_operation('4','2')">确定</button>
				</div>
	        </form>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
<!--批量积分变更 -->
<div class="modal fade" id="Thawjfbg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content" style="width:500px;height:400px;">
			<div class="modal-header">
				<h2 class="modal-title" id="myModalLabel" >
					<span style="font-weight:bold">积分变更</span>
				</h2>
			</div>
			<div class="modal-body">
				<form method="get" class="form-horizontal">
				<div class="row">
	                <div class="form-group">
		           		<label class="col-sm-3 control-label"style="margin-top:10px; min-width:100px;">变更类型：</label>
		           			<div class="radio radio-primary col-sm-5" style="width: 120px;margin-top:10px;">
					                <input type="radio" value="1" name="chooseType" name="limit_activity" >
					                <label>增加积分</label>
			           	</div>
	           				<div class="radio radio-primary col-sm-5" style="width: 120px;margin-top:10px;">
				                <input value="2" type="radio"  name="chooseType" name="limit_activity" >
				                <label>减少积分</label>
	           				</div>
		  			 </div>

	            </div>

	            <div class="row">
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">变更积分：</label>
	                    <div class="col-sm-5">
	                        <input type="text" id="integral" class="form-control integral" maxlength="10" onkeyup="value=value.replace(/[^\d]/g,'')">
	                    </div>
	                </div>
	            </div>

	            <div class="row">
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">变更理由：</label>
	                    <div class="col-sm-5">
	                        <textarea id="reason" style="width: 100%;height: 100px;" maxlength="300" class="form-control resouse"></textarea>
	                    </div>
	                </div>
	            </div>
				<div class="modal-footer" style="text-align:center;border-top:none;">
					<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right:40px;">取消</button>
					<button type="button" class="btn btn-primary" onclick="Batch_operation('3','')">确定</button>
				</div>
	        </form>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>

<!--批量积分变更 -->
<div class="modal fade" id="Thawjfbg2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h2 class="modal-title" id="myModalLabel" >
					<span style="font-weight:bold">批量积分变更</span>
				</h2>
			</div>
			<div class="modal-body">
				<form method="get" class="form-horizontal">

				  <div class="row">
	                  <div class="form-group">
		           		<label class="col-sm-3 control-label"style="margin-top:10px; min-width:100px;">变更类型：</label>
		           			<div class="radio radio-primary col-sm-5" style="width: 120px;">
					                <input type="radio" value="1" name="chooseType2" name="limit_activity">
					                <label>增加积分</label>
			           		</div>
	           				<div class="radio radio-primary col-sm-5" style="width: 120px;">
				                <input value="2" type="radio"  name="chooseType2" name="limit_activity" >
				                <label>减少积分</label>
	           				</div>
		  			 </div>


		  			<!--  <div class="col-sm-6  jfoucs">
		           		<label class="col-sm-5" style="margin-top:10px; min-width:100px;">变更类型</label>
		           		<a class="cfoucs" point="0"><div class="radio radio-primary col-sm-5" style="min-width:80px;">
					                <input id="no_limit" type="radio" checked="checked" value="1" name="chooseType2" >
					                <label for="no_limit" style="min-width:60px;">增加积分</label>
			           	</div></a>
			           	<a  class="cfoucs" point="">
	           				<div class="radio radio-primary col-sm-5" style="margin-top:10px;min-width:60px;">
				                <input id="limit" type="radio"  value="2" name="chooseType2" >
				                <label for="limit" style="min-width:100px;">减少积分</label>
	           				</div>
			           	</a>
		   </div>  -->



	            </div>
	            <div class="row">
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">变更积分：</label>
	                    <div class="col-sm-5">
	                    	<input type="hidden" id="aid"  value="">
	                        <input type="text" id="integral2" class="form-control integral" maxlength="10" onkeyup="value=value.replace(/[^\d]/g,'')">
	                    </div>
	                </div>
	            </div>

	            <div class="row">
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">变更理由：</label>
	                    <div class="col-sm-5">
	                        <textarea id="reason2" style="width: 100%;height: 100px;"  maxlength="300" class="form-control resouse"></textarea>
	                    </div>
	                </div>
	            </div>
				<div class="modal-footer"  style="text-align:center;border-top:none;">
					<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right:40px;">取消</button>
					<button type="button" class="btn btn-primary" onclick="SingleIntegral()">确定</button>
				</div>
	        </form>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
</body>


<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="<%=path %>/hplus/js/content.min.js?v=1.0.0"></script>
    <script src="<%=path %>/hplus/js/plugins/chosen/chosen.jquery.js"></script>
    <script src="<%=path %>/hplus/js/plugins/jsKnob/jquery.knob.js"></script>
    <script src="<%=path %>/hplus/js/plugins/jasny/jasny-bootstrap.min.js"></script>
    <script src="<%=path %>/hplus/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script src="<%=path %>/hplus/js/plugins/prettyfile/bootstrap-prettyfile.js"></script>
    <script src="<%=path %>/hplus/js/plugins/nouslider/jquery.nouislider.min.js"></script>
    <script src="<%=path %>/hplus/js/plugins/switchery/switchery.js"></script>
    <script src="<%=path %>/hplus/js/plugins/ionRangeSlider/ion.rangeSlider.min.js"></script>
    <script src="<%=path %>/hplus/js/plugins/iCheck/icheck.min.js"></script>
    <script src="<%=path %>/hplus/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="<%=path %>/hplus/js/plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
    <script src="<%=path %>/hplus/js/plugins/clockpicker/clockpicker.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/3.6.1/echarts.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.16/js/jquery.dataTables.min.js"></script>
	<script src="<%=path%>/hplus/js/plugins/suggest/bootstrap-suggest.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
    <script src="<%=path%>/hplus/js/plugins/sweetalert/sweetalert2.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/artDialog/7.0.0/dialog-plus.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.min.js"></script>
<script src="<%=path%>/hplus/js/plugins/zTree/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/marketing/dialog.js"></script>
<script type="text/javascript" src="<%=path%>/js/dateUtils.js"></script>
<script type="text/javascript">
    var path = "<%=path%>";
    var myDataTable;
    $.fn.dataTable.ext.errMode = 'none';
	var departmentCode="";
    $(function () {

    	$(".input-daterange").datepicker({keyboardNavigation: !1, forceParse: !1, autoclose: !0});
    	initZtree();
       /*  func_getYear();
        func_getMonth();
        func_getDay(); */
        $("[data-toggle='popover']").popover();
        $("#data_5 .input-daterange").datepicker({keyboardNavigation: !1, forceParse: !1, autoclose: !0});

        $(".jfoucs a").click(function(){
    		$(this).addClass("cfoucs").siblings().removeClass("cfoucs");

    	/* 	if($(this).attr("last_time") != undefined){
    			if($(this).attr("last_time") == ""){
        			$("#data_5").show();
        		}else{
        			$("#data_5").hide();
        		}
    		}else */ if($(this).attr("point") != undefined){
    			if($(this).attr("point") == ""){
        			$("#custPoint").show();
        		}else{
        			$("#custPoint").hide();
        		}
		    }

    	});

        init();

    });



    function addDempent(){
    		$("#myModal").modal("show");
    		$("#myModa4").modal("hide");
    }
    function hidein(){
    	$("#myModal").modal("hide");
    }
    $("font").hover(
    		  function () {
    		    $(this).append($("<span> ***</span>"));
    		  },
    		  function () {
    		    $(this).find("span:last").remove();
    		  }
    		);



  //初始化部门基础树
	function initZtree(){
    	//保存所有的部门节点数据
    	var zNodes =[];
		//发送ajax请求，从DB中查询该企业下，包含层级关系的全部部门
      	var url="<%=path%>/department/ajaxSelectAllDepartment";
    	$.post(url, {
		}, function(data) {
			var realData = data.data;
			if (data.status == 200) {
				for(var i=0;i<realData.length;i++){
					var treeData = null;
					//机构团队用不同的图标
					if(realData[i].companyType == 1){
					   treeData = {id:realData[i].id,companyType:realData[i].companyType,leaderName:realData[i].leaderName,pId:realData[i].parentDeptId, name:realData[i].name,title:realData[i].title,open:true,icon:"${pageContext.request.contextPath}/images/system/mechanismIcon.png"};
					}else{
					   treeData = {id:realData[i].id,companyType:realData[i].companyType,leaderName:realData[i].leaderName,pId:realData[i].parentDeptId, name:realData[i].name,title:realData[i].title,open:true,icon:"${pageContext.request.contextPath}/images/system/teamIcon.png"};
					}
					zNodes.push(treeData);
				}
				zTree(zNodes);
				zTreeLike(zNodes)
				ztreeData(zNodes);
			}else{
        		errorDialog(data.message);
        	}
		});
	}



	 function zTreeLike(treeData){
	        var zTree;
	        //用于保存用户选中的节点
	        var curNode;
	        //树属性的定义
	        var setting = {
	            check: {
	         	   enable: true,
	         	   chkStyle: "checkbox",   //勾选框类型(checkbox 或 radio）
	         	   chkboxType: { "Y": "", "N": "" }   //勾选 checkbox 对于父子节点的关联关系
	            },
	            //页面上的显示效果
	            view: {
	                showLine: false,
	                selectedMulti: false
	            },
	            data: {
	                simpleData: {
	                    enable:true,
	                    idKey: "id",
	                    pIdKey: "pId",
	                    rootPId: ""
	                },
		               key: {
		                   title: "title"
		               }
	            },
	            callback: {
	                beforeClick: getCurrentNode,
	                onClick : zTreeOnClick
	            }
	        };

	        function getCurrentNode(treeId, treeNode) {
	            curNode = treeNode;
	        }

	        //点击左侧的菜单树，动态展示右侧
	        function zTreeOnClick(){
	     	   $("#belognDepartmentId").val(curNode.id);
	     	   $("#belognDepartmentName").val(curNode.name);
	        	}

	        //初始化树
	        //var t = $("#tree");
	        var d = $("#treelike");
	       // t = $.fn.zTree.init(t, setting, treeData);
	        t = $.fn.zTree.init(d, setting, treeData);
	    }

	 /*
    chkboxType: { “Y”: “ps”, “N”: “ps” }
	   Y 属性定义 checkbox 被勾选后的情况；
	   N 属性定义 checkbox 取消勾选后的情况；
	   “p” 表示操作会影响父级节点；
	   “s” 表示操作会影响子级节点。
	   */
    //控件初始化部门基础树
    function zTree(treeData){
        var zTree;
        //用于保存用户选中的节点
        var curNode;
        //树属性的定义  
        var setting = {
            check: {
         	   enable: false,
         	   chkStyle: "checkbox",   //勾选框类型(checkbox 或 radio）
         	   chkboxType: { "Y": "", "N": "" }   //勾选 checkbox 对于父子节点的关联关系
            },
            //页面上的显示效果  
            view: {
                showLine: false,
                selectedMulti: false
            },
            data: {
                simpleData: {
                    enable:true,
                    idKey: "id",
                    pIdKey: "pId",
                    rootPId: ""
                },
	               key: {
	                   title: "title"
	               }
            },
            callback: {
                beforeClick: getCurrentNode,
                onClick : zTreeOnClick
            }
        };

        function getCurrentNode(treeId, treeNode) {
            curNode = treeNode;
        }

        //点击左侧的菜单树，动态展示右侧
        function zTreeOnClick(){
     	   $("#belognDepartmentId").val(curNode.id);
     	   $("#belognDepartmentName").val(curNode.name);
        	}

        //初始化树
        var t = $("#tree");
        //var d = $("#treelike");
        t = $.fn.zTree.init(t, setting, treeData);
        //t = $.fn.zTree.init(d, setting, treeData);
    }

   //设置某节点的选中状态
    function setTreeNoteSelect(treeName,id){
     	//根据id获取树的某个节点：
     	var zTree = $.fn.zTree.getZTreeObj(treeName);
     	var node = zTree.getNodeByParam("id",id);
     	//设置node节点选中状态：
     	zTree.selectNode(node);
    }
	   /*
       chkboxType: { “Y”: “ps”, “N”: “ps” }
	   Y 属性定义 checkbox 被勾选后的情况；
	   N 属性定义 checkbox 取消勾选后的情况；
	   “p” 表示操作会影响父级节点；
	   “s” 表示操作会影响子级节点。
	   */
       //数据权限部门树
	   function ztreeData(treeData){
           var zTree;
           //用于保存用户选中的节点
           var curNode;
           //树属性的定义
           var setting = {
               check: {
            	   enable: true,
            	   chkStyle: "checkbox",   //勾选框类型(checkbox 或 radio）
            	   chkboxType: { "Y": "s", "N": "s" }   //勾选 checkbox 对于父子节点的关联关系
               },
               //页面上的显示效果
               view: {
                   showLine: false,
                   selectedMulti: false
               },
               data: {
                   simpleData: {
                       enable:true,
                       idKey: "id",
                       pIdKey: "pId",
                       rootPId: ""
                   },
	               key: {
	                   title: "title"
	               }
               },
               callback: {
                   beforeClick: getCurrentNode,
                   onClick : zTreeOnClick
               }
           };

           function getCurrentNode(treeId, treeNode) {
               curNode = treeNode;
           }

           //点击左侧的菜单树，动态展示右侧
           function zTreeOnClick(){
           	}

           //初始化树
           var t = $("#treeData");
           t = $.fn.zTree.init(t, setting, treeData);
	   }


	 //用户选中了所在部门的取消
    function cancel(){
			//设置树的选中状态
			$("#myModa4").modal("hide");
    }

    //用户选中了所在部门的取消
    function cancelLike(){
    	$("#myModa4like").modal("hide");
    }
    /* 选择部门确定 */
    function addDempentlike(){
     	 //用户选择的模块权限
     	   	var treeObj = $.fn.zTree.getZTreeObj("treelike");
     	       nodes=treeObj.getCheckedNodes(true);
     	   	//拿到一组负责部门权限
     	   	var fzdepartment = "";
     	       for(var i=0;i<nodes.length;i++){
     	       	if(i == 0){
     	       		fzdepartment += nodes[i].id; //获取选中节点的值
     	       	}else{
     	       		fzdepartment += "," + nodes[i].id; //获取选中节点的值
     	       	}
     	    }
     	      departmentCode=fzdepartment;
     	    console.log("departmentIds---->"+departmentCode);
    	$("#myModa4like").modal("hide");
    }

    /*页面跳转  */
    function messagestaff(id){

    	if(id != 1){
    		window.location.href="<%=path%>/view/ui/deletestaffList";
    	}else{
    		window.location.href="<%=path%>/view/ui/staffList";
    	}
    }

    /*复选框  */
    $("#checkall").on("click", function() {
    	if($(this).prop("checked") === true) {
            /* $("name=checkList").prop("checked", $(this).prop("checked")); */
            $('[name=checkList]:checkbox').prop('checked',this.checked);//checked为true时为默认显示的状态
            $('#example tbody tr').addClass('selected');
        } else {
            $(".checkbox_select").prop("checked", false);
            $('#example tbody tr').removeClass('selected');
        }
    });

    /* 批量操作 */
    function Batch_operation(id,num){
    	var ids="";
    	var phones="";
    	if(num == 1){

    		ids = $("#jie").val();
    	}else if(num == 2){
    		ids = $("#del").val();
    		phones = $("#phon").val();
    	}else if(num == 3){
    		ids = $("#que").val();
    	}
    	if(ids == ""){
    		var checkedbox = $("input[name='checkList']:checked");
        	var  ids = "";
        	var phones="";
            if(checkedbox.length == 0){
            	errorDialog("","请选择要操作的员工");
            	return;
            }else{
                   /* ids = new Array(); */
                   checkedbox.each(function(){
                	   var a =this.value;
                	   //var b =this.pho;
                	   var b  = $(this).attr("pho");
                       ids+=a+ ",";
                	   phones+=b+ ",";
                   });
                   ids = ids.substr(0, ids.length - 1);
                   phones = phones.substr(0, ids.length - 1);
            }
    	}
    	if(id == 1){
    		 $.ajax({
    	            type: 'POST',
    	            url: path + "/staff/ajaxBatchFrozenOperation",
    	            data: {"ids":ids,"indexType":id},
    	            success: function (data) {
    	            	if(data.status == "200"){
    	            		successDialog("","操作成功");
    	            		setTimeout("location.reload();",1000);
    	            		/* location.reload(); */
    	            	}else if(data.status == "201"){
    	            		errorDialog("","批量冻结失败");
    	            	}else{
    	            		errorDialog("","远程请求错误");
    	            	}
    	            }
    	        });
    	}else if(id == 2){
    		 $.ajax({
 	            type: 'POST',
 	            url: path + "/staff/ajaxBatchFrozenOperation",
 	            data: {"ids":ids,"indexType":id},
 	            success: function (data) {
 	            	if(data.status == "200"){
	            		successDialog("","操作成功");
	            		setTimeout("location.reload();",1000);
	            	}else if(data.status == "201"){
	            		errorDialog("","批量解冻失败");
	            	}else{
	            		errorDialog("","远程请求错误");
	            	}
 	            }
 	        });
    	}else if(id == 3){
    		var index  = $('input[name="chooseType"]:checked').val();
    		var integral = $("#integral").val();
    		var reason = $("#reason").val();
    		if ($.trim(index) == "") {
    			errorDialog("","请选择变更类型");
                return;
            }
    		if(index == 2){
    			var integral = -integral;
    		}
    		if ($.trim(integral) == "") {
    			errorDialog("","请输入变更积分");
                return;
            }
    		if ($.trim(integral) == 0) {
    			errorDialog("","输入积分不符合规则");
                return;
            }
    		if ($.trim(reason) == "") {
    			errorDialog("","积分变更原因不能为空");
                return;
            }

    		if(/^[1-9]\d*${10}$/.test($.trim(name))){
    			errorDialog("","积分输入有误");
            	 return;
            }
   		 $.ajax({
	            type: 'POST',
	            url: path + "/staff/ajaxBatchFrozenIntegral",
	            data: {"ids":ids,"indexType":index,"integral":integral,"reason":reason},
	            success: function (data) {
	            	if(data.status == "200"){
	            		successDialog("","操作成功");
	            		setTimeout("location.reload();",1000);
	            	}else if(data.status == "201"){
	            		errorDialog("","批量变更积分失败,变更积分条件不符合");
	            	}else{
	            		errorDialog("","远程请求错误");
	            	}
	            }
	        });
 		}else if(id == 4){
 	   		 $.ajax({
 	            type: 'POST',
 	            url: path + "/staff/ajaxBatchFrozenDelete",
 	            data: {"ids":ids,"phones":phones},
 	            success: function (data) {
 	            	if(data.status == "200"){
	            		successDialog("","操作成功");
	            		setTimeout("location.reload();",1000);
	            	}else if(data.status == "201"){
	            		errorDialog("","批量删除失败");
	            	}else{
	            		errorDialog("","远程请求错误");
	            	}
 	            }
 	        });
  		}
    }
	/* 初始化页面 */
    function init() {
        myDataTable = dataTable();
    }
/*
    function func_getYear() {
        var now = new Date();
        var startYear = 1900;
        var endYear = now.getFullYear();

        var option = "";
        for (; startYear <= endYear; startYear++) {
            option += '<option value="' + startYear + '">' + startYear + '</option>';
        }
        $(".year").html(option);
    }
 */
    /* function func_getMonth() {
        var option = "";
        for (var i = 1; i <= 12; i++) {
            option += '<option value="' + i + '">' + i + '</option>';
        }
        $(".month").html(option);
    }
 */
    /* function func_getDay() {
        var year = $(".year:last").val();
        var month = $(".month:last").val();

        var now = new Date();
        now.setFullYear(year);
        now.setDate(1);
        now.setMonth(month);
        now.setDate(0);
        var lastDay = now.getDate();

        var option = "";
        for (var i = 1; i <= lastDay; i++) {
            option += '<option value="' + i + '">' + i + '</option>';
        }
        $(".day:last").html(option);
    } */


    function staffSaveDel(){
    	$("#totalname").text("添加员工");
    	 $(".phone:last").val(null);
       $(".name:last").val(null);
        $(".openId:last").val(null);
        $("#openId").attr('readOnly',false);
    	$("#myModa4").modal("hide");
    }

    //会员添加
    function func_saveStaff() {
    	var id=$("#staId").val();
        var phone = $(".phone:last").val();
        var name = $(".name:last").val();
        var openId = $(".openId:last").val();
        var departmentId = $("#belognDepartmentId").val();
        var departmentName = $("#belognDepartmentName").val();
        if ($.trim(phone) == "") {
        	errorDialog("","手机号码不能为空");
            return;
        }
        if (!/^1[34578]\d{9}$/.test($.trim(phone))) {
        	errorDialog("","手机号码不正确");
            return;
        }
        if($.trim(name)==""){
        	errorDialog("","姓名不能为空");
        	return;
        }
       /*  if(!/^[a-zA-Z\u4e00-\u9fa5]{1,10}$/.test($.trim(name))){
        	errorDialog("","姓名格式不正确");
        	return;
        } */
        if ($.trim(openId) == "") {
           errorDialog("","openID不能为空");
            return;
        }
        if(/[\u4E00-\u9FA5]{1,30}$/.test($.trim(openId))){
        	errorDialog("","openId不符合");
        	return;
        }
        if(id == ""){
	        if ($.trim(departmentId) == "") {
	           errorDialog("","部门不能为空");
	            return;
	        }
        }

        if(id != ""){

        	$.ajax({
                type: 'POST',
                url: path + "/staff/ajaxStaffUpdate",
                data: {"phone":phone,"name":name,"openId":openId,"departmentId":departmentId,"id":id,"departMentName":departmentName},
                success: function (data) {
                	if(data.status == "200"){
	            		successDialog("","修改成功");
	            		setTimeout("location.reload();",1000);
	            	}else if(data.status == "201"){
	            		errorDialog("","修改失败");
	            	}else{
	            		errorDialog("","远程请求错误");
	            	}
                }
            });
        	$("#totalname").text("添加员工");
        }else{
        	$.ajax({
                type: 'POST',
                url: path + "/staff/ajaxStaffSave",
                data: {"phone":phone,"name":name,"openId":openId,"departmentId":departmentId,"departMentName":departmentName},
                success: function (data) {
                	if(data.status == "200"){
	            		successDialog("","保存成功");
	            		setTimeout("location.reload();",1000);
	            	}else if(data.status == "201"){
	            		errorDialog("","电话号码已存在");
	            	}else if(data.status == "301"){
	            		errorDialog("","openId对应的员工已存在");
	            	}else if(data.status == "501"){
	            		errorDialog("","opeanId不存在");
	            	}else{
	            		errorDialog("","远程请求错误或微信二维码失败");
	            	}
                }
            });
        }

    }


	/* 查看详情 */
    function func_showMemberDetailDialog(id,indexType,phone) {
		if(indexType == 1){
			window.location.href="<%=path%>/view/ui/staffdetails?id="+id
			<%-- href="<%=path%>/view/ui/staffdetails?id="+id; --%>
   	}else if(indexType == 2){
   		$("#staId").val(id)
   		$("#myModal").modal("show");
   		$("#totalname").text("编辑员工");
   		$("#openId").attr('readOnly',true);
   		var dis = "disabled";
   		/* $("#openId") .attr("disabled",dis);  */
   		$.post(path+"/staff/ajaxGetStaff",{id:id},function(data){
			if(data.status == "200"){
				var staff = data.data.liststaff;
			        $(".phone:last").val(staff.phone);
			        $(".name:last").val(staff.name);
			        $(".openId:last").val(staff.openId);
			        setTreeNoteSelect("tree",staff.departmentId);
			}else if(data.status == "201"){
				errorDialog("","无记录");
			}else{
				errorDialog("","远程请求出错");
			}
		},"json");
   	}else if(indexType == 3){
   		$("#jie").val(id);
   		$("#Thaw").modal("show");
   	}else if(indexType == 4){
   		$("#aid").val(id);
   		$("#Thawjfbg2").modal("show");
   	}else if(indexType == 5){
		$("#del").val(id);
		$("#phon").val(phone);
		$("#Thawdelete").modal("show");
	}else if(indexType == 6){
		$("#que").val(id);
   		$("#ThawJ").modal("show");
	}
    }

 /*  //显示悬浮框
    function  showDialog(name , phone , departHtml , id){
        var follow = document.getElementById('active' + id);
        var d = dialog({
            width: 200,
            align: 'right',
            content:"<p>姓名："+name+"</p ><p>手机："+phone+"</p ><p>所属部门："+departHtml+"</p >",
            quickClose: true// 点击空白处快速关闭
        });
        d.show(follow);
    } */

    var staffInfoMap=new Map();
	function SingleIntegral(){
		var ids=$("#aid").val();
		var index  = $('input[name="chooseType2"]:checked').val();
		var integral = $("#integral2").val();
		var reason = $("#reason2").val()
		if(index == 2){
			var integral = -integral;
		}
		if ($.trim(index) == "") {
			errorDialog("","请选择变更类型");
            return;
        }
		if ($.trim(integral) == "") {
			errorDialog("","请输入变更积分");
            return;
        }
		if ($.trim(integral) == 0) {
			errorDialog("","输入的积分不符合规则");
            return;
        }
		if ($.trim(reason) == "") {
			errorDialog("","积分变更原因不能为空");
            return;
        }

		if(/^[1-9]\d*${10}$/.test($.trim(name))){
			errorDialog("","积分输入有误");
        	 return;
        }
		 $.ajax({
            type: 'POST',
            url: path + "/staff/ajaxBatchFrozenIntegral",
            data: {"ids":ids,"indexType":index,"integral":integral,"reason":reason},
            success: function (data) {
            	if(data.status == "201"){
            		errorDialog("","本次修改积分失败，修改积分不符合条件");
            	}else if(data.status == "200"){
            		successDialog("","操作成功");
            		setTimeout("location.reload();",1000);
            	}else{
            		errorDialog("","本次修改积分失败，远程错误");
            	}
            }
        });
	}


    //设置某节点的选中状态
    function setTreeNoteSelect(treeName,id){
     	//根据id获取树的某个节点：
     	var zTree = $.fn.zTree.getZTreeObj(treeName);
     	var node = zTree.getNodeByParam("id",id);
     	//设置node节点选中状态：
     	zTree.selectNode(node);
    }

    function func_dataTableReload() {
    	if(func_valid()){
	        myDataTable.ajax.reload();
    	}
    }

    $("#export").click(function(){
			var href = path+"/staff/exportStaffList";
/* 			var href = path+"/staff/exportStaffList?startTime="+startTime+"&endTime="+endTime+"&name="+name+"&phone="+phone+"&isFreeze="+isFreeze+"&scoreStart="+scoreStart+"&scoreEnd="+scoreEnd+"&departmentId="+departmentId; */
			/* href += "?startTime="+startTime+"&endTime="+endTime; */
			$(this).attr("href",href);
	});

   <%--  function nameClick(id){
    	window.location.href="<%=path%>/view/ui/staffdetails?id="+id
    } --%>
    function dataTable() {
        return $('#myTable').DataTable({
            processing: true,
     		ordering: false,
     		searching: false,
     		info: true,
     		autoWidth: true,
     		lengthChange: false,
     	    language: {
     	    	emptyTable: '<div id="content_empty"  class="form-group white-bg" style="text-align:center;padding:200px 0;margin:0;">   <p>暂无数据</p></div>',
     	    	info: '从第 _START_ 到第 _END_ 条数据；总共有 _TOTAL_ 条记录',
     			infoEmpty: '没有数据',
     			lengthMenu: '每页显示 _MENU_ 条记录',
     			loadingRecords: '正在加载数据....',
     			processing: '正在处理数据....',
     			zeroRecords: '没有找到匹配的记录',
     			paginate: {
     				first: '首页',
     				previous: '前页',
     				next: '后页',
     				last: '尾页'
     			}
     	    },
     	   order: [[7,'desc']],
     		pageLength: 20,
     	    pagingType: 'full_numbers',
     	    columns: func_columns(),
     	   	serverSide: true,
			columnDefs: [{
     	    	render: function(data, type, full) {
     	    		 var result = "";
                     if (data != null) {
                    	var phone = full.phone;
                         result = '<input class="checkbox_select" name="checkList" type="checkbox"  pho="'+phone+'"; value="'+data+'"/>';
                     }
                     return result;
            },
			targets: 0
     		},
     		{
                render: function (data, type, full) {
                    var result = "";
                    if (data == null) {
                        result = "——";
                    } else {
                        result = data;
                    }
                    return result;
                },
                targets: [1],
            },
     		{
                render: function (data, type, full) {
                    var result = "";
                    if (data == null) {
                        result = "——";
                    } else {
                    	var id=full.id;
                    	var href="<%=path%>/view/ui/staffdetails?id="+id;
                    	var departArry=full.departMentName.split("、");
                        var departHtml="";
                        for (var i=0;i<departArry.length;i++){
                            departHtml+= departArry[i] + "<br>";
                        }
                        staffInfoMap.set(full.id,full);
                    	result="<img style='width:20px;float:left;margin-top:20px;' class='card_click' >"
                             + "<a id='nameclick' href='"+href+"'>"
                             + "<img style='height:30px;width:30px;margin:0 0 0 6px;border-radius:50%;' onerror='loadDefalutImage(this)' src='"+full.headImg+"'>&nbsp;&nbsp;&nbsp;"
                          	 + "<font id='active"+full.id+"' color='#515151' >"+full.name+"</font></a>";
                    }
                    return result;
                },
                targets: [2]
            }, {
                render: function (data, type, full) {
                    var result = "";
                    if (data == null) {
                        result = "——";
                    } else {
                        result = data;
                    }
                    return result;
                },
                targets: [3],
            }, {
                render: function (data, type, full) {
                    var result = "";
                     if (data == null) {
                         result = "——";
                     } else {
                         result = data;
                     }
                    return result;
                },
                targets: [4],
            }, {
                render: function (data, type, full) {
                    var result = "";
                    if (data == null) {
                        result = "——";
                    } else {
                        result = data;
                    }
                    return result;
                },
                targets: [5],
            }, {
                render: function (data, type, full) {
                    var result = "";
                    if (data == null) {
                        result = "——";
                    } else {
                    	result = ""+formatDateTimeYMDHMS(data)
                    }
                    return result;
                },
                targets: [6],
            },{
                render: function (data, type, full) {
                    var result = "";
                    if (data == null) {
                        result = "——";
                    } else {
                    	if(full.isFreeze == 0){
                        	result = '正常';
                    	}else{
                    		result = '冻结';
                    	}
                    }
                    return result;
                },
                targets: [7]
            }, {
                render: function (data, type, full) {
                	var phone = full.phone;
                    var result = "";
                   <shiro:hasPermission name="employee:show">
                    result += '<a onclick="func_showMemberDetailDialog(\'' + data + '\',\'' + 1 + '\')" class="caozuo updateStatus">查看&nbsp;</a>&nbsp&nbsp;';
                    </shiro:hasPermission>
                    <shiro:hasPermission name="employee:edit">
                    result += '<a onclick="func_showMemberDetailDialog(\'' + data + '\',\'' + 2 + '\')" class="caozuo updateStatus">编辑</a>&nbsp&nbsp;';
                    </shiro:hasPermission>
                    if(full.isFreeze ==0){
                    	 <shiro:hasPermission name="employee:freeze">
                    	result += '<a onclick="func_showMemberDetailDialog(\'' + data + '\',\'' + 3 + '\')" class="caozuo updateStatus">冻结</a>&nbsp&nbsp;';
                    	</shiro:hasPermission>
                    }else{
                    	<shiro:hasPermission name="employee:thaw">
                    	result += '<a onclick="func_showMemberDetailDialog(\'' + data + '\',\'' + 6 + '\')" class="caozuo updateStatus">解冻</a>&nbsp&nbsp;';
                    	</shiro:hasPermission>
                    }
					<shiro:hasPermission name="employee:change_integral">
                    result += '<a onclick="func_showMemberDetailDialog(\'' + data + '\',\'' + 4 + '\')" class="caozuo updateStatus"  data-target="#Thawjfbg">积分变更</a>&nbsp&nbsp;';
                    </shiro:hasPermission>
                    <shiro:hasPermission name="employee:delete">
                    result += '<a onclick="func_showMemberDetailDialog(\'' + data + '\',\'' + 5 + '\',\'' + phone + '\')" class="caozuo updateStatus">删除</a>&nbsp&nbsp;';
                    </shiro:hasPermission>
                    return result;
                },
                targets: 8
            }],
     	    serverSide: true,
     	    ajax: {
     	    	contentType: 'application/json',
     	    	type: 'POST',
     	    	url: func_AjaxUrl(),
     	    	data: function(d){
     				d.extra_search = func_ajaxData();
     				return JSON.stringify(d);
     	    	}
     	    },
     	   "initComplete": function(settings, json) {
		   	  $(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",});
		   	    }
		   	}).on( 'draw', function () {
		   		$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",});
		   		staffInfoMap.forEach(function (element, index, array) {
        			var html="<p style='color:#515151' >姓名："+element.name+"</p ><p style='color:#515151'>手机："+element.phone+"</p><p style='color:#515151'>所属部门："+element.departMentName+"</p >";
    				$("#active"+element.id).popover({
    	                html: true, // 为true的话，data-content里就能放html代码了
    	                content:html,
    	                trigger:'hover',
    	                placement:'top',
    	                placement: "right",
    	                delay: {hide: 100}
    	        	}).on('shown.bs.popover', function (event) {
    	                var that = this;
    	                $(this).parent().find('div.popover').on('mouseenter', function () {
    	                    $(that).attr('in', true);
    	                }).on('mouseleave', function () {
    	                    $(that).removeAttr('in');
    	                    $(that).popover('hide');
    	                });
    	            }).on('hide.bs.popover', function (event) {
    	                if ($(this).attr('in')) {
    	                    event.preventDefault();
    	                }
    	            });
        		});

		   	});

    }
        function func_AjaxUrl() {
            return path + "/staff/ajaxstaffPageList";
      }

      function func_columns() {
          var jsonArr = [
			  {"data": "id"},
              {"data": "index"},
              {"data": "name","sDefaultContent" : "","sClass" : "center" },
              {"data": "departMentName","sClass" : "center"},
              {"data": "name","sClass" : "center"},
              {"data": "phone","sClass" : "center"},
              {"data": "focusTime","sClass" : "center"},
              {"data": "isFreeze"},
              {"data": "id"}
          ];
          return jsonArr;
      }

      function func_ajaxData() {
          var jsonObject = new Object();
          if ($.trim($("#phone").val()) != "") {
        	  if (!/^1[34578]\d{9}$/.test($.trim($("#phone").val()))) {
                 errorDialog("","手机号码不正确");
                  jsonObject.phone = null;
              }else{
              	jsonObject.phone = $("#phone").val();
              }
          }
          if($.trim($("#name").val()) != ""){
          	jsonObject.name = $.trim($("#name").val());
          }
          if($.trim($("#is_freeze").val()) != ""){
          	jsonObject.isFreeze = $.trim($("#is_freeze").val());
          }
          /* if($.trim($("#starttime").val()) != ""){ */
          	jsonObject.startTime = $("#starttime").val()+" 00:00:00";
          	jsonObject.endTime = $("#endtime").val()+" 23:59:59";
          /* } */
          if($("a[point].cfoucs").attr("point") == ""){
          	if($("#point1").val() != ""){
  	        	jsonObject.scoreStart = parseInt($("#point1").val());
          	}
          	if($("#point2").val() != ""){
  	        	jsonObject.scoreEnd = parseInt($("#point2").val());
          	}
          }
           jsonObject.departmentCode = departmentCode;

         /*  var treeObj=$.fn.zTree.getZTreeObj("tree")
          var nodes=treeObj.getCheckedNodes(true)
          var jsonObject.departmentid =nodes[i].id */
          return jsonObject;
      }


	//验证
	function func_valid(){
		var point1 = $("#point1").val();
		var point2 = $("#point2").val();
		if($("a[point]:last").hasClass("cfoucs") && point1!='' && point2!=''){
			point1 = parseInt(point1);
			point2 = parseInt(point2);
			if(point1 > point2){
				var d = dialog({
					align: 'right',
					content: '第二个值应比第一个值大'
				}).show($("#point2")[0]);
				setTimeout(function () {
					d.close().remove();
				}, 1600);
				return false;
			}
		}
		 if ($.trim($("#phone").val()) != "") {
       	  if (!/^1[34578]\d{9}$/.test($.trim($("#phone").val()))) {
       		var d = dialog({
				align: 'right',
				content: '手机号码输入有误'
			}).show($("#phone")[0]);
			setTimeout(function () {
				d.close().remove();
			}, 1600);
			return false;
             }
         }

		return true;
	}


	function toMove(num,id) {
	    if (num==1){
            $("#move"+id).show();
		} else{
            $("#move"+id).hide();
		}

    }



</script>
</html>